<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google 地图 JavaScript API 示例: 事件上下文</title>
    <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAZmXMr_CK_cr3dQEBaSfZxxSa62ZIXg0b_hVgPDiJNfHX-IdpWxTtbAwHVB4h4W_kLEUEdf3jo5L1Sw"
            type="text/javascript"></script>
    <script type="text/javascript">
	
	var clat = 30.781;
	var clng = 106.136;	
	
    function initialize() {
      if (GBrowserIsCompatible()) {
	  
        var map = new GMap2(document.getElementById("map_canvas"));

        map.addControl(new GLargeMapControl());
        map.addMapType(G_PHYSICAL_MAP);
         //map.addControl(new GMapTypeControl());
        map.addControl(new GMenuMapTypeControl());
        map.addControl(new GOverviewMapControl());
        map.addControl(new GScaleControl());

        map.setCenter(new GLatLng(clat, clng), 9);
	
                GEvent.addListener(map, "moveend", function() {
                    var center = map.getCenter();
					document.getElementById("txtlat").value = center.lat();
					document.getElementById("txtlng").value = center.lng();
                });
				
      }
    }  
    </script>
  </head>

  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 100%; height: 500px"></div>
	<table>
	<tr>
	<td>
	<input type="text" name="T1" id="txtlng" size="20" maxlength="128" value="aaaa">
	</td>
	<td>
	<input type="text" name="T1" id="txtlat" size="20" maxlength="128" value="bbbb">
	</td>
	</tr>
	</table>
  </body>
</html>

